import { createRouter, createWebHashHistory } from 'vue-router'
import config from '@/config'
import ChildPage from '@/views/ChildPage/index.vue'

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: [
        // 重定向
        {
            path: '/',
            redirect: '/fpi-child/MajorGuarantee',
        },
        // 微应用路由页面
        ...config.microAppList.map(item => {
            return {
                // 设置动态路由，/xxxx/one、/xxxx/two，以及所有/xxxx开头的路由都指向ChildPage组件
                path: `${item.baseroute}/:page*`,
                name: item.name,
                component: ChildPage,
            }
        }),
    ],
})

export default router
